import { axios } from '@/utils/request'
import { getAction, deleteAction, putAction, postAction, httpAction, postFormData } from '@/api/manage'
const gateway = '/gateway/api'
const aiApi = gateway + '/admin/goods/ai'
const stylingApi = gateway + '/admin/styling'
const askBox = gateway + '/admin/customerAskBox'
const cus = gateway + '/admin/customer'
const mem = gateway + '/admin/member'
const channel = gateway + '/admin/channel'
const api = {
  getCustomerAskBoxInfo: askBox + '/customerAskBoxInfoById',
  getVouchersById: cus + '/getVouchersById',
  vouchersList: cus + '/vouchersList',
  changeStylingCartSort: stylingApi + '/changeStylingCartSort',
  getMemberConsumeInfo: mem + '/consume/getMemberConsumeInfo',
  getMemberRecentBrowse: mem + '/consume/getMemberRecentBrowse',
  getMemberCoupon: mem + '/consume/getMemberCoupon',

}
export default api
// 查询顾客优惠券信息
export function vouchersList (data) {
  return axios({
    url: api.vouchersList,
    method: 'post',
    data
  })
}
// 查询七鱼会话会员信息
export function getMemberConsumeInfo (data) {
  return axios({
    url: api.getMemberConsumeInfo,
    method: 'post',
    data
  })
}
// 查询七鱼会员浏览列表
export function getMemberRecentBrowse (data) {
  return axios({
    url: api.getMemberRecentBrowse,
    method: 'post',
    data
  })
}
// 查询七鱼会员优惠券
export function getMemberCoupon (data) {
  return axios({
    url: api.getMemberCoupon,
    method: 'post',
    data
  })
}

// 查询顾客生日优惠卷信息
export function getVouchersById (unionId) {
  return axios({
    url: api.getVouchersById + '?unionId=' + unionId,
    method: 'get'
  })
}

// 更改购物车排序数据
export function changeStylingCartSort (data) {
  return axios({
    url: api.changeStylingCartSort,
    method: 'post',
    data: data
  })
}

// 查询要盒需求信息
export const getCustomerAskBoxInfo = (params) => getAction(api.getCustomerAskBoxInfo, params)

export const saveCustomer = (params) => postAction(gateway + '/admin/customer/saveCustomer', params)// 保存用户信息

export const aiSingle = (data) => postAction(aiApi + '/searchSingle', data) // 搜索AI单品
export const aiLook = (data) => postAction(aiApi + '/searchLook', data) // 搜索AI-LOOK

// 商品
export const queryDim = (data) => postAction(gateway + '/admin/product/queryDim', data) // 查询分类、品牌等数据
export const queryGoods = (data) => postAction(gateway + '/admin/product/queryGoods', data) // 查询商品
export const queryStock = (data) => postAction(gateway + '/admin/product/queryStock', data) // 查询商品库存
export const batchQuerySpuStock = data => postAction(gateway + '/openapi/product/batchQuerySpuStock', data) // 批量查询SPU商品库存
export const querySkus = (data) => postAction(gateway + '/admin/product/querySkus', data) // 查询商品所有SKU
export const goodsDetail = (data) => postAction(gateway + '/admin/product/goodsDetail', data) // 查询商品详情

// 后台搭盒
export const addStylingCart = (data) => postAction(stylingApi + '/addStylingCart', data) // 搭盒商品添加购物车
export const addBatchStylingCart = (data) => postAction(stylingApi + '/addBatchStylingCart', data) // 搭盒商品批量添加购物车
export const createStylingDetail = (data) => postAction(stylingApi + '/createStylingDetail', data) // 搭盒-创建搭配明细
export const createStylingTpl = (data) => postAction(stylingApi + '/createStylingTpl', data) // 搭盒-创建搭配模版
export const batchCreateStylingDetail = (data) => postAction(stylingApi + '/batchCreateStylingDetail', data) // 搭盒-批量创建搭配明细
export const createLook = (data) => postAction(stylingApi + '/createLook', data) // 搭盒-创建一套搭配

// export const customerinfo = (data) => postAction(stylingApi + '/customerinfo', data) // 查询用户基础信息

export const deleteStylingCart = (data) => postAction(stylingApi + '/deleteStylingCart', data) // 搭盒商品购物车删除
export const deleteStylingCartByIds = (data) => postAction(stylingApi + '/deleteStylingCartByIds', data) // 批量删除搭盒商品购物车

export const deleteStylingDetail = (data) => postAction(stylingApi + '/deleteStylingDetail', data) // 搭盒-删除搭配明细
export const deleteStylingTpl = (data) => postAction(stylingApi + '/deleteStylingTpl', data) // 搭盒-删除搭配模版
export const findStylingCart = (data) => postAction(stylingApi + '/findStylingCart', data) // 查询搭盒商品购物车数据
export const queryStylingTpl = (data) => postAction(stylingApi + '/queryStylingTpl', data) // 搭盒-查询look列表
export const updateStylingCart = (data) => postAction(stylingApi + '/updateStylingCart', data) // 搭盒商品修改购物车记录
export const initStylingCart = (data) => postAction(stylingApi + '/initStylingCart', data) // 初始化主题搭配商品到购物车
export const calcUnitPrice = (id) => getAction(stylingApi + '/calcUnitPrice?styLingCartId=' + id) // 根据购物车id计算单品价格

export const saveBox = (data) => postAction(stylingApi + '/saveBox', data) // 保存服务单
export const pocketTemplateList = (data) => postAction(stylingApi + '/pocketTemplateList', data) // 获取衣袋模板
export const getReturnTags = (data) => postAction(stylingApi + '/getReturnTags', data) // 获取同小类商品反馈
export const selectProductByTag = (data) => postAction(stylingApi + '/selectProductByTag', data) // 根据标签获取同反馈的商品
export const updateStylingBase = (data) => postAction(stylingApi + '/updateStylingBase', data) // 更新搭配简介
export const assignmentShopCartFPrice = (params) => postAction(gateway + '/admin/styling/assignmentShopCartFPrice', params)  //  更新购物车优惠价-保存服务单前调用

// 主动要盒后台
export const getDealAmount = (parameter) => getAction(askBox + '/getDealAmount?userId = ' + parameter) // 获取本月定制盒子成交金额
export const getFashionerByType = (parameter) => getAction(askBox + '/getFashionerByType?type=' + parameter) // 根据类型获取搭配师
export const askList = (data) => postAction(askBox + '/list', data) // 主动要盒列表
export const insertRemark = (id, remark) => getAction(askBox + '/insertRemark?id=' + id + '&remark=' + remark) // 填写备注
export const findMsg = (id) => getAction(askBox + '/findMsg?id=' + id) // 获取主动要盒留言

export const cancelAskBox = (data) => postAction(askBox + '/cancelAskBox', data) // 取消主动要盒
export const getChangeFashioner = (id) => getAction(askBox + '/getChangeFashioner?id=' + id) // 获取可更换搭配师

export const getChnnelType = (data) => postAction(channel + '/listChannel', data) //获取渠道

export const changeFashioner = (data) => postAction(askBox + '/changeFashioner', data) // 更换搭配师
export const getCustomerDefLogistic = (customerAskId, unionId) => getAction(askBox + '/getCustomerDefLogistic?customerAskId=' + customerAskId + '&unionId=' + unionId) // 获取默认地址
export const getCustomerAskBoxCondition = () => postAction(askBox + '/getCustomerAskBoxCondition') // 获取主动要盒查询条件
export const updateIsConnect = (params) => getAction(askBox + '/updateIsConnect', params) // 修改是否联系
export const updateConnectSuccess = (params) => getAction(askBox + '/updateConnectSuccess', params) // 修改是否联系成功

// 顾客后台
export const selectLogistics = (unionId) => getAction(cus + '/selectLogistics?unionId=' + unionId) // 查看顾客地址列表
export const saveLogistic = (data) => postAction(cus + '/saveLogistic', data) // 保存地址修改数据
export const getAreaData = () => getAction(cus + '/getAreaData') // 省市区数据
export const selectById = (unionId, cardNo) => getAction(cus + '/selectById?unionId=' + unionId + '&cardNo=' + cardNo) // 查询顾客详情
export const getGroupOrder = (data) => postAction(cus + '/getGroupOrder', data) // 获取集团消费记录


export const getByDescription = (description) => getAction(gateway + '/admin/attr/getByDescription?description=' + description) // 根据描述获取标签列表(要盒取消理由)

// 导购超时会员
export const grabList = (params) => postAction(gateway + '/admin/shoppingGuideOvertimeCustomer/list', params) // 导购超时会员列表
export const grabOrder = (params) => postAction(gateway + '/admin/shoppingGuideOvertimeCustomer/grabOrder', params) // 抢单
export const distributionOrders = (params) => postAction(gateway + '/admin/shoppingGuideOvertimeCustomer/distributionOrders', params) // 分配单
export const checkFasSame = (params) => postAction(gateway + '/admin/shoppingGuideOvertimeCustomer/checkFasSame', params) // 验证当前导购和任务导购是否为同一人
export const getFashioners = (params) => postAction(gateway + '/admin/shoppingGuideOvertimeCustomer/getFashioners', params)  // 获取全部搭配师接口

// 主动要盒
export const batchCheckDealer = (params) => postAction(gateway + '/admin/customerAskBox/batchCheckDealer', params) // 批量判断用户是否经销
export const staticsticFashionerData = (params) => postAction(gateway + '/admin/customerAskBox/staticsticFashionerData', params) // 统计数据

// 商品
export const getSizeNos = () => getAction(gateway + '/admin/product/getSizeNos') // 商品尺码数据信息
export const queryGoodsList = (params) => postAction(gateway + '/admin/product/queryGoodsList', params)  //  查询商品 （搭配师改版一期）
export const batchTagsByUnionIdAndskc = (params) => postAction(gateway + '/admin/product/batchTagsByUnionIdAndskc', params)  //  根据用户unionId 和 款号 款色 来展示标签
export const productInLooks = (params) => postAction(gateway + '/admin/product/productInLooks', params)  //  根据skc 查询look，查询出所有的有这套skc的look，然后再es中做in操作 ， 不分页
export const queryWeMoProductIds = params => postAction(gateway + '/admin/product/queryWeMoProductIds', params) // 查询商品对应的微盟商品Id

// 搭配
export const stylingList = params => postAction(gateway + '/admin/styling/stylingList', params) // 导购-搭配列表
export const stylingTags = params => postAction(gateway + '/corp/styling/stylingTags', params) // 导购-搭配标签
export const findByLookIds = params => postAction(gateway + '/admin/product/findByLookIds', params)  // 根据lookIds 查询列表


export const searchSimilarGoods = params => postAction(gateway + '/admin/goods/ai/searchSimilarGoods', params) // 查询商品推荐
export const getMemberRecentBrowseing = (weMoProductId, weid) => getAction(gateway + '/admin/product/queryGoodsDetailByWeMoId?weMoProductId=' + weMoProductId + '&weid=' + weid) // 查询正在浏览的商品
export const brandCondition = params => postAction(gateway + '/admin/goods/card/brandCondition', params) // 获取品牌卡
export const querySpu = params => postAction('/gateway/api/admin/product/querySpu', params) // 微盟查询商品的SPU库存
